<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
    <!--{include file='comm/header.tpl'}-->
    <!--{if $operFlg == 2}-->
        <title>添加文章分类</title>
    <!--{else}-->
        <title>修改文章分类</title>
    <!--{/if}-->
</head>
<body>
<div style="width:100%">

    <div class="items clearfix">
        <h2 style="" class="tal">正在操作：<!--{if $operFlg == 2}-->添加文章分类<!--{else}-->修改文章分类<!--{/if}--></h2>
        <div class="items2">

            <!--{if $error_msg}-->

            <div class="error-box">
                <!--{$error_msg}-->
            </div>

            <!--{else}-->

            <form id="article_form" onsubmit="return false;">
                <table>
                    <tbody>
                        <tr>
                            <td class="tar" width="150">分类别名：</td>
                            <td width="*"><input type="text" value="<!--{$article_category_array.category_index}-->" maxlength="20" id="index" name="index" style="width:250px;ime-mode:active" /></td>
                        </tr>
                        <tr>
                            <td class="tar">分类标题：</td>
                            <td>
                                <input type="text" id="title" name="title" maxlength="200" value="<!--{$article_category_array.category_title}-->"><font color="red">*</font>
                            </td>
                        </tr>
                        <tr>
                            <td class="tar">分类类型：</td>
                            <td>
                                <select id="type" name="type">
                                    <option value="1"<!--{if $article_category_array.category_type == 1}--> selected="selected"<!--{/if}-->>帮助文章</option>
                                    <option value="2"<!--{if $article_category_array.category_type == 2}--> selected="selected"<!--{/if}-->>公告文章</option>
                                    <option value="3"<!--{if $article_category_array.category_type == 3}--> selected="selected"<!--{/if}-->>新闻文章</option>
                                </select>
                            </td>
                        </tr>
                        <tr>
                            <td class="tar">使用标志：</td>
                            <td>
                                <input type="radio" name="useFlg" value="1" <!--{if $operFlg == 2 || $article_category_array.useFlg == 1}--> checked="checked"<!--{/if}--> />启用
                                <input type="radio" name="useFlg" value="0" <!--{if $operFlg == 3 && $article_category_array.useFlg == 0}--> checked="checked"<!--{/if}-->  />禁用
                            </td>
                        </tr>
                        <tr>
                            <td class="tar">描述：</td>
                            <td>
                                <textarea name="description"><!--{$article_category_array.description}--></textarea>
                                <input type="hidden" name="id" value="<!--{$article_category_array.category_id|default:0}-->" />
                            </td>
                        </tr>
                    </tbody>
                </table>
            </form>

            <!--{/if}-->

        </div>
    </div>


    <div class="bottom_fixbox">
        <div class="rectbox tac">
            <input type="button" class="btn" onclick="article.check();" value="<!--{if $operFlg == 2}-->添加文章分类<!--{else}-->修改文章分类<!--{/if}-->" />&nbsp;&nbsp;&nbsp;
            <input type="button" class="btn" onclick="E.closeWindows();" value="关闭" />
        </div>
    </div>

</div>

<script type="text/javascript">

    var article = {

        dt: "",

        operFlg: <!--{$operFlg}-->,

        check: function() {
            this.dt = E.getFormValues("article_form");
            var error_msg = "";
            if (this.dt.index == "")
                error_msg += "分类别名不能为空<br />";
            if (this.dt.category_title == "")
                error_msg += "分类标题不能为空<br />";
			            
            if (error_msg != "")
                E.alert(error_msg);
            else {
                <!--{if $operFlg == 2}-->
                E.confirm("您确认要添加文章分类吗？", "article.add");
                <!--{else}-->
                E.confirm("您确认要修改文章分类吗？", "article.add");
                <!--{/if}-->
            }

        },

        add: function() {
        	$.ajax({
                type: "POST",
                url: "/invokingAjax-backend/content/article.ajax?operFlg=2",
                dataType: "JSON",
                data: this.dt,
                success: function( result_obj ) {
                    if (result_obj.code == 200) {
                        E.opener("article.load");
                        if (article.operFlg == 2) {
                            E.alert(result_obj.message, 2, "E.refresh");
                        } else {
                            E.alert(result_obj.message, 2, "E.closeWindows");
                        }
                    } else {
                        E.alert(result_obj.message);
                    }
                }
            });
        }
    };

</script>

</body>

</html>
